home *** CD-ROM | disk | FTP | other *** search
- # Jedi Knight Missions Cog
- #
- # S1L2_elev_switch.cog
- #
- # [DS/RD/IS/JS/TL/SS}
- #
- # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
- # ========================================================
-
- symbols
-
- message startup
- message damaged
- message arrived
- message killed
- message timer
-
- surface button mask=0x448 linkid=1
-
- thing elevator linkid=2
- thing turret linkid=3
- thing tank0 linkid=2
- thing tank1 linkid=2
- thing tank2
- thing sparkspot nolink
- thing sparkspot1 nolink
-
- template spark=+sparks local
-
- flex start_wait=0.25 desc=pause_before_moving_up
- flex sleeptime=2.0
- flex speed=4.0
-
- flex minimumDelay=2.0
- flex maximumDelay=4.0
- flex nextSpark=0.5 local
-
- int targetframe local
- int counter=0 local
- int player local
-
- template spark=+sparks local
-
- #sound wav0=Activate02.wav local
- sound kyleline
-
- end
-
- # =========================================================
- code
- startup:
- player=GetLocalPlayerThing();
- AttachThingToThing(tank2, elevator);
- AttachThingToThing(sparkspot1, elevator);
- return;
-
- damaged:
- if (GetSenderId() != 1) return;
- if (GetWallCel(button) == 1) return;
-
- if (GetSenderId() == 1)
- {
- // SetWallCel(button, 1);
- // PlaySoundPos(wav0, SurfaceCenter(button), 0.6, -1, -1, 0);
- MoveToFrame(elevator, targetframe, speed);
- SetTimer(nextspark);
- sleep(2.0);
- if (GetThingHealth(player) == 0) return;
- PlaySoundLocal(kyleline, 3.5, 0, 256);
- jkPrintUNIString(-1, 60069);
-
- }
- return;
-
- arrived:
- counter = (counter + 1);
- if ((counter % 8) >= 5) targetframe = (8 - (counter % 8));
- else targetframe = (counter % 8);
- MoveToFrame(elevator, targetframe, speed);
- CreateThing(spark, sparkspot1);
- return;
-
- killed:
- if (GetSenderId() == 3)
- {
- DamageThing(tank0, 100, 0, 0);
- DamageThing(tank1, 100, 0, 0);
- }
- return;
-
- timer:
-
- CreateThing(spark, sparkspot);
- // PlaySoundThing(sparksound, sparkspot, 2, -1, -1, 0);
-
- nextSpark = minimumDelay + (Rand() * (maximumDelay - minimumDelay));
- SetTimer(nextSpark);
- return;
- end
-